<template>
  <div>
    <el-card class="box-card">
      <div
        v-for="(item, index) in list"
        :key="index"
        class="text item">
        <router-link :to="{
            name: 'todo-show',
            params: {
              id: item.id
            }
          }">
          {{ item.content }}
        </router-link>
      </div>
    </el-card>
<!--    <ul v-if="list.length > 0">
      <template v-for="(item, index) of list">
        <li :key="index">
          <router-link :to="{
            name: 'todo-show',
            params: {
              id: item.objectId
            }
          }">
            {{ item.content }}
          </router-link>
        </li>
      </template>
    </ul>
    <h1 v-else>暂无数据</h1>-->
  </div>
</template>

<script>
export default {
  name: "TodoItems",
  props: {
    list: {
      type: Array,
      default: () => []
      // default: () => ({}) // obj
      // default: () => {} // obj
    }
  }
}
</script>

<style lang="scss" scoped>
.item {
  height: 40px;
  line-height: 40px;
  border-bottom: 1px solid #f0b1b1;

  &:nth-child(2n-1) {
    background-color: #f0b1b1;
  }
}
</style>